package customer.zspt.cn.customer.Adapter;

import android.content.Context;
import android.support.v4.view.PagerAdapter;
import android.view.View;
import android.view.ViewGroup;

import java.util.List;

import customer.zspt.cn.customer.components.order.orderVp.BaseVpItem;
import customer.zspt.cn.customer.bean.OrderMsgDao;

/**
 * Created by Administrator on 2018/7/18 0018.
 */

public class OrderVpAdapter extends PagerAdapter {
    private Context mContext;
    private OrderMsgDao.OrderMsg mOrderMsg;
    private  List<BaseVpItem> order_view_childLs;
    public OrderVpAdapter(Context context, List<BaseVpItem> order_view_childLs)
    {
        this. mContext= context;
        this.order_view_childLs = order_view_childLs;
    }
    @Override
    public int getCount() {
        return order_view_childLs.size();
    }
    @Override
    public boolean isViewFromObject(View view, Object object) {
        return view==object;
    }
    @Override
    public Object instantiateItem(ViewGroup container, int position) {
        BaseVpItem baseVpItem = order_view_childLs.get(position);
        container.addView(baseVpItem.mRootView);
        baseVpItem.initData();
        return baseVpItem.mRootView;
    }

    @Override
    public void destroyItem(ViewGroup container, int position, Object object) {
        container.removeView((View) object);
    }


}
